import { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
import App from "../App";
const Home = lazy(() => import("../page/home/Index"));
const Order = lazy(() => import("../page/order/Index"));
const List = lazy(() => import("../page/list/Index"));
const Message = lazy(() => import("../page/message/Index"));
const Set = lazy(() => import("../page/set/Index"));
const Menu = lazy(() => import("../page/set/menu/Index"));
const Login = lazy(() => import("../page/login/Index"));
const Detail = lazy(() => import("../page/detail/Index"));
export const houseroutes = [
  {
    path: "/home/order",
    element: <Order></Order>,
    title: "订单",
  },
  {
    path: "/home/list",
    element: <List></List>,
    title: "列表",
  },
  {
    path: "/home/message",
    element: <Message></Message>,
    title: "消息",
  },
  {
    path: "/home/set",
    element: <Set></Set>,
    title: "设置",
    children: [
      {
        path: "/home/set/menu",
        element: <Menu></Menu>,
        title: "菜单",
      },
    ],
  },
];
const routes = createBrowserRouter([
  {
    path: "/",
    element: <App></App>,
    children: [
      {
        index: true,
        element: <Home></Home>,
      },
      {
        path: "/home",
        element: <Home></Home>,
        children: houseroutes,
      },
    ],
  },
  {
    path: "/detail",
    element: <Detail></Detail>,
  },
  {
    path: "/login",
    element: <Login></Login>,
  },
]);
export default routes;
